/**   
* @Title: FengKongShenHeController.java 
* @Package com.zjdiepu.www.manage.api.zpp 
* 
* @author zhangpp
* @date 2017年5月26日 上午10:31:11 
* @version V1.0   
*/
package com.zjdiepu.www.manage.api.zpp.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import java.io.FileReader;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.dao.DataAccessException;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.core.RedisCallback;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import springfox.documentation.annotations.ApiIgnore;

import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.zjdiepu.www.base.BaseController;
import com.zjdiepu.www.base.core.AbstractSysUser;
import com.zjdiepu.www.base.core.ApiResponse;
import com.zjdiepu.www.base.core.BaseException;
import com.zjdiepu.www.base.core.PageVo;
import com.zjdiepu.www.base.enums.status.ThirdBusiStatus;
import com.zjdiepu.www.base.enums.type.BusinessExtrasCodeType;
import com.zjdiepu.www.base.enums.type.BusinessExtrasType;
import com.zjdiepu.www.base.enums.type.DataDicType;
import com.zjdiepu.www.base.enums.type.ModeIDType;
import com.zjdiepu.www.base.enums.type.NewsType;
import com.zjdiepu.www.base.enums.type.OperateType;
import com.zjdiepu.www.base.enums.type.ResultFlagType;
import com.zjdiepu.www.biz.helper.ServiceHelper;
import com.zjdiepu.www.common.util.CollectionInitUtil;
import com.zjdiepu.www.common.util.ZhppDateUtil;
import com.zjdiepu.www.commpent.RedisObjectClient;
import com.zjdiepu.www.ibiz.base.IDpBaseDealerInfoService;
import com.zjdiepu.www.ibiz.base.ISysUserService;
import com.zjdiepu.www.ibiz.cache.ICachedDictionaryService;
import com.zjdiepu.www.ibiz.dz.IDzGpsListService;
import com.zjdiepu.www.ibiz.fk.IFkAuditListService;
import com.zjdiepu.www.ibiz.fk.IFkPreAuditInfoService;
import com.zjdiepu.www.ibiz.other.IOtherAuditInfoService;
import com.zjdiepu.www.ibiz.yw.IYwBusinessExtrasService;
import com.zjdiepu.www.ibiz.yw.IYwBusinessService;
import com.zjdiepu.www.ibiz.yw.IYwFeesSubService;
import com.zjdiepu.www.ibiz.zpp.FengKongShenHeService;
import com.zjdiepu.www.ibiz.zpp.PublicService;
import com.zjdiepu.www.ibiz.zpp.SystemService;
import com.zjdiepu.www.model.base.dto.SimpleDataDictionary;
import com.zjdiepu.www.model.base.dto.SysUser;
import com.zjdiepu.www.model.fk.dto.FkAuditList;
import com.zjdiepu.www.model.fk.dto.FkPreAuditInfo;
import com.zjdiepu.www.model.fk.ext.FkAuditListExt;
import com.zjdiepu.www.model.other.dto.OtherAuditInfo;
import com.zjdiepu.www.model.other.ext.OtherAuditInfoExt;
import com.zjdiepu.www.model.yw.dto.YwBusiness;
import com.zjdiepu.www.model.yw.dto.YwBusinessExtras;
import com.zjdiepu.www.model.yw.dto.YwFeesSub;
import com.zjdiepu.www.model.zpp.fksh.dto.FengKongShenHeV001ZiDongExe;
import com.zjdiepu.www.model.zpp.fksh.ext.ParamsExt;
import com.zjdiepu.www.model.zpp.fksh.vo.EventPass;
import com.zjdiepu.www.model.zpp.fksh.vo.FKAuditVo;
import com.zjdiepu.www.model.zpp.fksh.vo.FkAuditListVo;
import com.zjdiepu.www.model.zpp.fksh.vo.OtherAuditInfoListVo;
import com.zjdiepu.www.model.zpp.fksh.vo.YwBusinessExtrasVo;
import com.zjdiepu.www.model.zpp.pub.ext.WhereSqlExt;
import com.zjdiepu.www.util.CachedEnums;

/**      
 * 项目名称：diepu-parent-manage   
 * 类名称：FengKongShenHeController   
 * 类描述：   
 * 创建人：zhangpp
 * 创建时间：2017年5月26日 上午10:31:11   
 * 修改人：zhangpp
 * 修改时间：2017年5月26日 上午10:31:11   
 * 修改备注：   
 * @version V1.0     
 */
@RestController
@RequestMapping(value= "FengKongShenHeController", produces="application/json;charset=UTF-8")
@Api(tags = {"作者：张鹏鹏，电话：15158822934"}, produces="application/json;charset=UTF-8")
public class FengKongShenHeController extends BaseController
{

	private static final Logger logger = LoggerFactory.getLogger(FengKongShenHeController.class);
	
	@Resource
	private FengKongShenHeService fengKongShenHeService;
	
	@Resource
	private IFkAuditListService iFkAuditListService;
	
	@Resource
	private ICachedDictionaryService cachedDictionaryService;
	
	@Resource
	private IYwBusinessService iYwBusinessService;
	
	@Resource
    private IOtherAuditInfoService otherAuditInfoService;
	
	@Resource
	private IYwBusinessExtrasService iYwBusinessExtrasService;
	
	@Resource
	private IFkPreAuditInfoService iFkPreAuditInfoService;
	
	@Resource
	private IDpBaseDealerInfoService iDpBaseDealerInfoService;
	
	@Resource
	private IDzGpsListService iDzGpsListService;
	
	@Resource
	private PublicService publicService;
	
	@Resource
	private ServiceHelper serviceHelper;
	
	@Resource
	private RedisObjectClient redisObjectClient;
	
	@Resource
	private ISysUserService iSysUserService;
	
	@Resource
	private SystemService systemService;
	
	@Resource
	private IYwFeesSubService ywFeesSubService;
	
	
	/**
	* 风控审核预审信息
	*  @author  zhangpp
	*  @Title:  diepuYushen  
	*    
	*  @param  @param fkPreAuditInfo
	*  @param  @return        设定文件  
	*  @return  Map<String,Object>        返回类型  
	*  @version  V1.0
	*  @throws
	 */
	@RequestMapping(value = "diepuYushen", method = RequestMethod.POST)
	public Map<String, Object> diepuYushen(FkPreAuditInfo fkPreAuditInfo) 
    {
		Map<String, Object> maps = success();
		AbstractSysUser currentUser = getCurrentUser();
		fengKongShenHeService.diepuYushen(currentUser, fkPreAuditInfo);
		return maps;
    }
	
	/**
	*  修改审核批注信息
	*  @author  zhangpp
	*  @Title:  insertOtherAudit  
	*    
	*  @param  @param otherAuditInfo
	*  @param  @return        设定文件  
	*  @return  Map<String,Object>        返回类型  
	*  @version  V1.0
	*  @throws
	 */
	@RequestMapping(value = "insertOtherAudit", method = RequestMethod.POST)
	public Map<String, Object> insertOtherAudit(OtherAuditInfo otherAuditInfo) 
    {
		Map<String, Object> maps = success();
		AbstractSysUser currentUser = getCurrentUser();
		fengKongShenHeService.insertOtherAudit(currentUser, otherAuditInfo);
		return maps;
    }
	
	/**
	*  通融区域经理审核  不过审
	*  @author  zhangpp
	*  @Title:  examineImplementFail  
	*    
	*  @param  @param otherAuditInfo
	*  @param  @return        设定文件  
	*  @return  Map<String,Object>        返回类型  
	*  @version  V1.0
	*  @throws
	 */
	@RequestMapping(value = "examineImplementFail", method = RequestMethod.POST)
	public Map<String, Object> examineImplementFail(OtherAuditInfo otherAuditInfo) 
    {
		Map<String, Object> maps = success();
		AbstractSysUser currentUser = getCurrentUser();
		fengKongShenHeService.diepuExamineImplementFail(otherAuditInfo, currentUser);
		return maps;
    }
	
	/**
	*  稽核审核
	*  财务审核一
	*  财务审核二
	*  @author  zhangpp
	*  @Title:  examineImplement  
	*    
	*  @param  @param otherAuditInfo
	*  @param  @return        设定文件  
	*  @return  Map<String,Object>        返回类型  
	*  @version  V1.0
	*  @throws
	 */
    @RequestMapping(value = "examineImplement", method = RequestMethod.POST)
	public Map<String, Object> examineImplement(OtherAuditInfo otherAuditInfo) 
    {
		Map<String, Object> maps = success();
		AbstractSysUser currentUser = getCurrentUser();
		fengKongShenHeService.diepuExamineImplement(otherAuditInfo, currentUser);
		return maps;
    }
	
	/**
	*  资料补齐删除
	*  @author  zhangpp
	*  @Title:  tuiHuiShenHe  
	*    
	*  @param  @param busiId
	*  @param  @return        设定文件  
	*  @return  Map<String,Object>        返回类型  
	*  @version  V1.0
	*  @throws
	 */
	@ApiOperation(value = "资料补齐删除", response = Boolean.class, httpMethod="POST", tags={"资料补齐删除"})
    @RequestMapping(value = "deleteQianzl", method = RequestMethod.POST)
    public Map<String, Object> deleteQianzl(String busiId) 
    {
		Map<String, Object> maps = success();
		AbstractSysUser currentUser = getCurrentUser();
		int index = fengKongShenHeService.deleteQianzl(busiId, currentUser);
		maps.put("index", index);
		return maps;
    }
	
	/**
	* 退回审核
	* @author zhangpp
	* @Title: tuiHuiShenHe 
	* 
	* @param @param paramsExt
	* @param @return    设定文件 
	* @return Map<String,Object>    返回类型 
	* @version V1.0
	* @throws
	 */
	@ApiOperation(value = "过户审核退回修改", response = Boolean.class, httpMethod="POST", tags={"过户审核退回修改"})
    @RequestMapping(value = "tuiHuiShenHe", method = RequestMethod.POST)
    public Map<String, Object> tuiHuiShenHe(String busiId,String modeId,String audit_detail,String audit_postil) 
    {
		Map<String, Object> maps = success();
		AbstractSysUser currentUser = getCurrentUser();
		fengKongShenHeService.diepuTuiHuiShenHe(currentUser, busiId, modeId,audit_detail,audit_postil);
		return maps;
    }
	
	/**
	* 风控审核解锁
	* @author zhangpp
	* @Title: fengKongShenHeJieSuo 
	* 
	* @param @param whereSqlExt
	* @param @return    设定文件 
	* @return Map<String,Object>    返回类型 
	* @version V1.0
	* @throws
	 */
	@ApiOperation(value = "风控审核解锁",response = FkAuditList.class, httpMethod="POST", tags={"风控审核执行操作"})
    @RequestMapping(value = "fengKongShenHeJieSuo", method = RequestMethod.POST)
	public Map<String, Object> fengKongShenHeJieSuo(@ModelAttribute WhereSqlExt whereSqlExt)
	{
		Map<String, Object> maps = success();
		
		//登录信息
		AbstractSysUser currentUser = getCurrentUser();
		String modifier = currentUser.getId();
		String modifier_name = currentUser.getName();
		
		//审核数据主键
		String replaceId =  whereSqlExt.getReplaceId();
		
		//查询审核记录
		FkAuditList fkAuditList = iFkAuditListService.selectById(replaceId);
		
		if(null != fkAuditList && !("").equals(fkAuditList))
		{
			if(modifier.equals(fkAuditList.getOperatorId()))
			{
				String whereSql = "update fk_audit_list t set t.operator_id = '',t.operator_name = '',t.modified = unix_timestamp(),t.modifier = '"+modifier+"',t.modifier_name = '"+modifier_name+"' where t.id = '"+replaceId+"'";
				whereSqlExt.setWhereSql(whereSql);
				publicService.updateWhereSql(whereSqlExt);
				return maps;
			}
		}
		
		maps.put("flag", 100900);
		maps.put("message", "不能操作别人锁定的审核数据！");
		return maps;
	}
	
	/**
	* 添加业务附件表
	* @author zhangpp
	* @Title: saveYwFuJianBiao 
	* 
	* @param @param ywBusinessExtras
	* @param @return    设定文件 
	* @return ApiResponse    返回类型 
	* @version V1.0
	* @throws
	 */
	@ApiOperation(value = "新增业务信息_附加信息", response = Boolean.class, httpMethod="POST", tags={"新增"})
    @RequestMapping(value = "saveYwFuJianBiao", method = RequestMethod.POST)
    public Map<String, Object> saveYwFuJianBiao(ParamsExt paramsExt) throws Exception
    {
		Map<String, Object> maps = success();
		
    	AbstractSysUser currentUser = getCurrentUser();
    	
    	//查询审核数据
    	FkAuditList fkAuditList = iFkAuditListService.selectById(paramsExt.getReplaceId());
    	
    	if(null != fkAuditList && !("").equals(fkAuditList))
    	{
    		String operatorId = fkAuditList.getOperatorId().trim();
    		String id = currentUser.getId().trim();
    		
    		boolean b = (!operatorId.equals(id));
    		
    		if(b)
    		{
    			maps.put("flag", 100900);
    			maps.put("message", "不能操作别人锁定的审核数据！");
    			return maps;
    		}
    	}
    	
    	//加装gps数据
    	YwBusinessExtras businessExtras = new YwBusinessExtras();
    	businessExtras.setBusiId(paramsExt.getBusiId());
    	businessExtras.setCodeExtras(BusinessExtrasCodeType.ADD_GPS.getCode());
		businessExtras.setTypeExtras(BusinessExtrasType.AUDIT.getCode());
    	businessExtras = iYwBusinessExtrasService.selectRefined(businessExtras);
    	if(null == businessExtras || ("").equals(businessExtras))
    	{
    		if(null != paramsExt.getAddGps_value_extras() && !("").equals(paramsExt.getAddGps_value_extras()))
    		{
    			YwBusinessExtras ywBusinessExtras = new YwBusinessExtras();
        		ywBusinessExtras.setBusiId(paramsExt.getBusiId());
        		ywBusinessExtras.setCodeExtras(BusinessExtrasCodeType.ADD_GPS.getCode());
        		ywBusinessExtras.setTypeExtras(BusinessExtrasType.AUDIT.getCode());
        		ywBusinessExtras.setNameExtras("AddGps附加值");
        		ywBusinessExtras.setModifier(currentUser.getId()); //统一使用修改人和修改人名称来初始化
        		ywBusinessExtras.setModifierName(currentUser.getName());
        		ywBusinessExtras.setValueExtras(paramsExt.getAddGps_value_extras());
        		iYwBusinessExtrasService.saveUpdateAndDelete(ywBusinessExtras, OperateType.add);
    		}
    	}
    	else
    	{
    		YwBusinessExtras ywBusinessExtras = new YwBusinessExtras();
    		ywBusinessExtras.setId(businessExtras.getId());
    		ywBusinessExtras.setBusiId(paramsExt.getBusiId());
    		ywBusinessExtras.setCodeExtras(BusinessExtrasCodeType.ADD_GPS.getCode());
    		ywBusinessExtras.setTypeExtras(BusinessExtrasType.AUDIT.getCode());
    		ywBusinessExtras.setNameExtras("AddGps附加值");
    		ywBusinessExtras.setModifier(currentUser.getId()); //统一使用修改人和修改人名称来初始化
    		ywBusinessExtras.setModifierName(currentUser.getName());
    		ywBusinessExtras.setValueExtras(paramsExt.getAddGps_value_extras());
    		iYwBusinessExtrasService.saveUpdateAndDelete(ywBusinessExtras, OperateType.edit);
    	}
    	
    	//审核附加值  
    	businessExtras = new YwBusinessExtras();
    	businessExtras.setBusiId(paramsExt.getBusiId());
    	businessExtras.setCodeExtras(BusinessExtrasCodeType.ADD_GEPOSIT.getCode());
		businessExtras.setTypeExtras(BusinessExtrasType.AUDIT.getCode());
    	businessExtras = iYwBusinessExtrasService.selectRefined(businessExtras);
    	if(null == businessExtras || ("").equals(businessExtras))
    	{
    		if(null != paramsExt.getAddGeposit_value_extras() && !("").equals(paramsExt.getAddGeposit_value_extras()))
    		{
    			YwBusinessExtras ywBusinessExtras = new YwBusinessExtras();
        		ywBusinessExtras.setBusiId(paramsExt.getBusiId());
        		ywBusinessExtras.setCodeExtras(BusinessExtrasCodeType.ADD_GEPOSIT.getCode());
        		ywBusinessExtras.setTypeExtras(BusinessExtrasType.AUDIT.getCode());
        		ywBusinessExtras.setNameExtras("AddGeposit附加值");
        		ywBusinessExtras.setModifier(currentUser.getId()); //统一使用修改人和修改人名称来初始化
        		ywBusinessExtras.setModifierName(currentUser.getName());
        		ywBusinessExtras.setValueExtras(paramsExt.getAddGeposit_value_extras());
        		iYwBusinessExtrasService.saveUpdateAndDelete(ywBusinessExtras, OperateType.add);
    		}
    	}
    	else
    	{
    		YwBusinessExtras ywBusinessExtras = new YwBusinessExtras();
    		ywBusinessExtras.setId(businessExtras.getId());
    		ywBusinessExtras.setCodeExtras(BusinessExtrasCodeType.ADD_GEPOSIT.getCode());
    		ywBusinessExtras.setTypeExtras(BusinessExtrasType.AUDIT.getCode());
    		ywBusinessExtras.setNameExtras("AddGeposit附加值");
    		ywBusinessExtras.setModifier(currentUser.getId()); //统一使用修改人和修改人名称来初始化
    		ywBusinessExtras.setModifierName(currentUser.getName());
    		ywBusinessExtras.setValueExtras(paramsExt.getAddGeposit_value_extras());
    		iYwBusinessExtrasService.saveUpdateAndDelete(ywBusinessExtras, OperateType.edit);
    	}
    	
    	//特殊订单
    	businessExtras = new YwBusinessExtras();
    	businessExtras.setBusiId(paramsExt.getBusiId());
    	businessExtras.setCodeExtras(BusinessExtrasCodeType.IS_SPECIAL_ORDER.getCode());
		businessExtras.setTypeExtras(BusinessExtrasType.AUDIT.getCode());
    	businessExtras = iYwBusinessExtrasService.selectRefined(businessExtras);
    	if(null == businessExtras || ("").equals(businessExtras))
    	{
    		if(null != paramsExt.getBoxOrder() && !("").equals(paramsExt.getBoxOrder()) && !("0").equals(paramsExt.getBoxOrder()))
    		{
    			YwBusinessExtras ywBusinessExtras = new YwBusinessExtras();
        		ywBusinessExtras.setBusiId(paramsExt.getBusiId());
        		ywBusinessExtras.setCodeExtras(BusinessExtrasCodeType.IS_SPECIAL_ORDER.getCode());
        		ywBusinessExtras.setTypeExtras(BusinessExtrasType.AUDIT.getCode());
        		ywBusinessExtras.setNameExtras("IsSpecialOrder附加值");
        		ywBusinessExtras.setModifier(currentUser.getId()); //统一使用修改人和修改人名称来初始化
        		ywBusinessExtras.setModifierName(currentUser.getName());
        		ywBusinessExtras.setValueExtras(paramsExt.getBoxOrder());
        		iYwBusinessExtrasService.saveUpdateAndDelete(ywBusinessExtras, OperateType.add);
    		}
    	}
    	else
    	{
    		YwBusinessExtras ywBusinessExtras = new YwBusinessExtras();
    		ywBusinessExtras.setId(businessExtras.getId());
    		ywBusinessExtras.setCodeExtras(BusinessExtrasCodeType.IS_SPECIAL_ORDER.getCode());
    		ywBusinessExtras.setTypeExtras(BusinessExtrasType.AUDIT.getCode());
    		ywBusinessExtras.setNameExtras("IsSpecialOrder附加值");
    		ywBusinessExtras.setModifier(currentUser.getId()); //统一使用修改人和修改人名称来初始化
    		ywBusinessExtras.setModifierName(currentUser.getName());
    		ywBusinessExtras.setValueExtras(paramsExt.getBoxOrder());
    		iYwBusinessExtrasService.saveUpdateAndDelete(ywBusinessExtras, OperateType.edit);
    	}
    	
    	//收费变通
    	businessExtras = new YwBusinessExtras();
    	businessExtras.setBusiId(paramsExt.getBusiId());
    	businessExtras.setCodeExtras(BusinessExtrasCodeType.FLEXIBLECHARGE.getCode());
		businessExtras.setTypeExtras(BusinessExtrasType.AUDIT.getCode());
    	businessExtras = iYwBusinessExtrasService.selectRefined(businessExtras);
    	if(null == businessExtras)
    	{
    		if(null != paramsExt.getFlexibleCharge() && !("").equals(paramsExt.getFlexibleCharge()))
    		{
    			YwBusinessExtras ywBusinessExtras = new YwBusinessExtras();
        		ywBusinessExtras.setBusiId(paramsExt.getBusiId());
        		ywBusinessExtras.setCodeExtras(BusinessExtrasCodeType.FLEXIBLECHARGE.getCode());
        		ywBusinessExtras.setTypeExtras(BusinessExtrasType.AUDIT.getCode());
        		ywBusinessExtras.setNameExtras("FlexibleCharge附加值");
        		ywBusinessExtras.setModifier(currentUser.getId()); 
        		ywBusinessExtras.setModifierName(currentUser.getName());
        		ywBusinessExtras.setValueExtras(paramsExt.getFlexibleCharge());
        		iYwBusinessExtrasService.saveUpdateAndDelete(ywBusinessExtras, OperateType.add);
    		}
    		
    	}
    	else
    	{
    		if(null != paramsExt.getFlexibleCharge() && !("").equals(paramsExt.getFlexibleCharge()))
    		{
    			YwBusinessExtras ywBusinessExtras = new YwBusinessExtras();
        		ywBusinessExtras.setId(businessExtras.getId());
        		ywBusinessExtras.setCodeExtras(BusinessExtrasCodeType.FLEXIBLECHARGE.getCode());
        		ywBusinessExtras.setTypeExtras(BusinessExtrasType.AUDIT.getCode());
        		ywBusinessExtras.setNameExtras("FlexibleCharge附加值");
        		ywBusinessExtras.setModifier(currentUser.getId()); //统一使用修改人和修改人名称来初始化
        		ywBusinessExtras.setModifierName(currentUser.getName());
        		ywBusinessExtras.setValueExtras(paramsExt.getFlexibleCharge());
        		iYwBusinessExtrasService.saveUpdateAndDelete(ywBusinessExtras, OperateType.edit);
    		}
    	}
    	
    	//点击保存GPS和押金按钮时，如果yw_fees_sub已经存在征信押金，将页面上的征信押金值更新到 yw_fees_sub；
    	YwFeesSub ywFeesSub = new YwFeesSub();
    	ywFeesSub.setBusiId(paramsExt.getBusiId());
    	ywFeesSub.setItemCode("35");
    	ywFeesSub.setDpStatus(1);
    	ywFeesSub = ywFeesSubService.selectRefined(ywFeesSub);
    	if(null != ywFeesSub)
    	{
    		if(StringUtils.isNotBlank(paramsExt.getAddGeposit_value_extras()))
    		{
    			ywFeesSub.setAmountItem(Double.valueOf(paramsExt.getAddGeposit_value_extras()));
    		}
    		else
    		{
    			ywFeesSub.setAmountItem(0.0);
    		}
    		ywFeesSubService.saveUpdateAndDelete(ywFeesSub, OperateType.edit);
    	}
    	
    	//发短息通知
    	logger.debug("gps保存");
    	systemService.diepuNewsHandle(currentUser, "M_fkgps", NewsType.TZ27.getCode(), paramsExt.getBusiId(), null);
        return maps;
    }
	
	
	/**
	* 风控审核  退回查询 
	* @author zhangpp
	* @Title: list 
	* 
	* @param @param otherAuditInfoExt
	* @param @return    设定文件 
	* @return ApiResponse    返回类型 
	* @version V1.0
	* @throws
	 */
	@ApiOperation(value = "风控审核  退回查询 ",response = OtherAuditInfo.class, httpMethod="POST", tags={"风控审核  退回查询 "})
    @RequestMapping(value = "getOtherInfolist", method = RequestMethod.POST)
    public ApiResponse getOtherInfolist(@ModelAttribute OtherAuditInfoExt otherAuditInfoExt){
		
		//排序
		String orderSql = " created desc";
		otherAuditInfoExt.setOrderSql(orderSql);
        otherAuditInfoExt.notDeleted();
        PageVo page = getPage(otherAuditInfoExt);
        int records = otherAuditInfoService.countByExt(otherAuditInfoExt);
        page.setRecords(records);
        if (records > 0) {
            List<OtherAuditInfo> otherAuditInfos = otherAuditInfoService.selectByExt(otherAuditInfoExt);
            page.setRows(otherAuditInfos);
        } else {
            page.setRows(CollectionInitUtil.emptyList());
        }
        return ApiResponse.success(page);
    }
	
	/**
	 * 大额审批
	 * @param fkAuditList
	 * @param ywBusiness
	 * @param otherAuditInfo
	 * @param paramsExt
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@ApiOperation(value = "风控审核执行操作",response = FkAuditList.class, httpMethod="POST", tags={"风控审核执行操作"})
    @RequestMapping(value = "fengKongShenHeModifyDedksp", method = RequestMethod.POST)
	public Map<String, Object> fengKongShenHeModifyDedksp(@ModelAttribute FkAuditList fkAuditList,YwBusiness ywBusiness,OtherAuditInfo otherAuditInfo,ParamsExt paramsExt,HttpServletRequest request)throws Exception
	{
		Map<String, Object> maps = success();
		HttpSession session = request.getSession();      
		ServletContext  application  = session.getServletContext();  
		AbstractSysUser currentUser = getCurrentUser();
		String serverRealPath = application.getRealPath("/WEB-INF/configure/fkshConf.json");
		
		//修改操作人
		WhereSqlExt whereSqlExt = new WhereSqlExt();
		String whereSql = "update fk_audit_list t set t.operator_id = '"+currentUser.getId()+"',t.operator_name = '"+currentUser.getName()+"' where t.busi_id = '"+fkAuditList.getBusiId()+"' and t.mode_id = '"+fkAuditList.getModeId()+"' and t.dp_status = 1 and t.status_list = 1";
		whereSqlExt.setWhereSql(whereSql);
		publicService.updateWhereSql(whereSqlExt);
		
		fengKongShenHeService.diepuFengKongShenHeModify(currentUser, fkAuditList, ywBusiness, otherAuditInfo, paramsExt,serverRealPath);
		return maps;
	}
	
	/**
	* 风控审核执行操作
	* @author zhangpp
	* @Title: fengKongShenHeModify 
	* 
	* @param @param currentUser
	* @param @param fkAuditList
	* @param @param ywBusiness
	* @param @param otherAuditInfo
	* @param @param paramsExt
	* @param @return    设定文件 
	* @return ApiResponse    返回类型 
	* @version V1.0
	* @throws
	 */
	@ApiOperation(value = "风控审核执行操作",response = FkAuditList.class, httpMethod="POST", tags={"风控审核执行操作"})
    @RequestMapping(value = "fengKongShenHeModify", method = RequestMethod.POST)
	public Map<String, Object> fengKongShenHeModify(@ModelAttribute FkAuditList fkAuditList,YwBusiness ywBusiness,OtherAuditInfo otherAuditInfo,ParamsExt paramsExt,HttpServletRequest request)throws Exception
	{
		Map<String, Object> maps = success();
		HttpSession session = request.getSession();      
		ServletContext  application  = session.getServletContext();  
		AbstractSysUser currentUser = getCurrentUser();
		String serverRealPath = application.getRealPath("/WEB-INF/configure/fkshConf.json");
		FkAuditList fk = new FkAuditList();
		fk.setModeId(fkAuditList.getModeId());
		fk.setBusiId(fkAuditList.getBusiId());
		fk.setStatusList(1);
		fk = iFkAuditListService.selectRefined(fk);
		String id = currentUser.getId();
		if(null != fk.getOperatorId() && id.equals(fk.getOperatorId()))
		{
			fengKongShenHeService.diepuFengKongShenHeModify(currentUser, fkAuditList, ywBusiness, otherAuditInfo, paramsExt,serverRealPath);
		}
		else
		{
			maps.put("flag", "100900");
			maps.put("message", "当前审核已经被锁定！");
		}
		return maps;
	}
	
	/**
	* 风控审核 通用 历史审批查询
	* @author zhangpp
	* @Title: getOtherAuditInfoListVo 
	* 
	* @param @param paramsExt
	* @param @return
	* @param @throws Exception    设定文件 
	* @return ApiResponse    返回类型 
	* @version V1.0
	* @throws
	 */
	@RequestMapping(value="getOtherAuditListVo",method = RequestMethod.POST, produces="application/json;charset=UTF-8")
	public Map<String, Object> getOtherAuditListVo(@ApiIgnore ParamsExt paramsExt) throws Exception
	{
		Map<String, Object> maps = success();
		String orderSql = " t.created desc ";
		paramsExt.setOrderSql(orderSql);
		if(null != paramsExt && null != paramsExt.getBusiId() && !("").equals(paramsExt.getBusiId()))
		{
			String whereSql = " and t.busi_id = '"+ paramsExt.getBusiId() +"'";
			paramsExt.setWhereSql(whereSql);
		}
		List<OtherAuditInfoListVo> result = fengKongShenHeService.getOtherAuditInfoListVo(paramsExt);
		paramsExt.setOrderSql("");
		maps.put("result", result);
		
		//风控审核 资料补齐补审 GPS数据查询
		if(null != paramsExt && !("").equals(paramsExt))
		{
			if(null != paramsExt.getModeId() && !("").equals(paramsExt.getModeId()))
			{
				if(paramsExt.getGps().equals("GPS"))
				{
					String busiId = paramsExt.getBusiId();
					if(null != busiId && !("").equals(busiId))
					{
						String whereSql = " and t.busi_id = '"+busiId+"'";
						paramsExt.setWhereSql(whereSql);
						List<YwBusinessExtrasVo> gpsResult = fengKongShenHeService.getYwBusinessExtrasVo(paramsExt);
						maps.put("gpsResult", gpsResult);
					}
				}
			}
			
			if(null != paramsExt.getMode_code() && !("").equals(paramsExt.getMode_code()))
			{
				if(paramsExt.getMode_code().equals("ZLCODE"))
				{
					String busiId = paramsExt.getBusiId();
					YwBusiness ywBusiness = iYwBusinessService.selectById(busiId);
					maps.put("ywBusiness", ywBusiness);
				}
			}
			
			if(null != paramsExt.getM_ys() && paramsExt.getM_ys().equals("ok"))
			{
				FkPreAuditInfo fkPreAuditInfo = new FkPreAuditInfo();
				fkPreAuditInfo.setBusiId(paramsExt.getBusiId());
				fkPreAuditInfo.setModeId(paramsExt.getModeId());
				fkPreAuditInfo.setDpStatus(1);
				fkPreAuditInfo = iFkPreAuditInfoService.selectRefined(fkPreAuditInfo);
				maps.put("fkPreAuditInfo", fkPreAuditInfo);
			}
		}
		
		//待审批列表查询
		String modeId = paramsExt.getModeId();
		String busiId = paramsExt.getBusiId();
		FkAuditList fkAuditList = new FkAuditList();
		fkAuditList.setModeId(modeId);
		fkAuditList.setBusiId(busiId);
		fkAuditList.setDpStatus(1);
		fkAuditList.setStatusList(1);
	    fkAuditList = iFkAuditListService.selectRefined(fkAuditList);
		maps.put("fkAuditList", fkAuditList);
		return maps;
	}
	
	/**
	* 风控审核模块查询列表
	* @author zhangpp
	* @Title: getFengKongShenHelist 
	* 
	* @param @param fkAuditListExt
	* @param @return    设定文件 
	* @return ApiResponse    返回类型 
	* @version V1.0
	* @throws
	 */
	@ApiOperation(value = "风控审核模块查询列表",response = FkAuditList.class, httpMethod="POST", tags={"风控审核模块查询列表"})
    @RequestMapping(value = "getFengKongShenHelist", method = RequestMethod.POST)
    public ApiResponse getFengKongShenHelist(@ModelAttribute FkAuditListExt fkAuditListExt,ParamsExt paramsExt) throws Exception
	{
		String whereSql = "";
		
		if(null != paramsExt && !("").equals(paramsExt))
		{
			String modeId = paramsExt.getModeId();
			
			if(null != modeId && !("").equals(modeId))
			{
				whereSql += "and t.mode_id = '"+modeId+"' and t.status_list = '"+fkAuditListExt.getStatusList()+"'";
			}
			
			String cusName = paramsExt.getCustomerName();
			
			if(null != cusName && !("").equals(cusName))
			{
				fkAuditListExt.setCusName(cusName);
			}
			
			String salersmanName = paramsExt.getSalesmanName();
			
			if(null != salersmanName && !("").equals(salersmanName))
			{
				fkAuditListExt.setSalersmanName(salersmanName);
			}
			
			int dayEnum = paramsExt.getDayEnum();
			int stamp = ZhppDateUtil.dateConvertStamp();
			
			if(dayEnum == 1)
			{
				whereSql += " and t.created >= "+stamp + " and t.created < "+(stamp + 86400);
			}
			else if(dayEnum == 2)
			{
				whereSql += " and t.created < "+stamp + " and t.created >= "+(stamp - 86400 * 2);  
			}
			else if(dayEnum == 3)
			{
				whereSql += " and t.created > (unix_timestamp() - 3600 * 24 * 7) ";
			}
			
			String submitTimeStart = paramsExt.getSubmitTimeStart();
			String submitTimeEnd = paramsExt.getSubmitTimeEnd();
			
			if((null != submitTimeStart && !("").equalsIgnoreCase(submitTimeStart)) && (null != submitTimeEnd && !("").equals(submitTimeEnd)))
			{
				int start = ZhppDateUtil.dateConvertTimeStamp(submitTimeStart, "yyyy-MM-dd");
				int end =  ZhppDateUtil.dateConvertTimeStamp(submitTimeEnd, "yyyy-MM-dd");
				whereSql += " and t.created >= "+start + " and t.created < "+ (end + 86400);
			}
			else
			{
				if(null != submitTimeStart && !("").equals(submitTimeStart))
				{
					int start = ZhppDateUtil.dateConvertTimeStamp(submitTimeStart, "yyyy-MM-dd");
					whereSql += " and t.created >= "+start;
				}
				else if(null != submitTimeEnd && !("").equals(submitTimeEnd))
				{
					int end =  ZhppDateUtil.dateConvertTimeStamp(submitTimeEnd, "yyyy-MM-dd");
					whereSql += " and t.created < "+ (end + 86400);
				}
			}
		}
		
		//按数据范围查询
		AbstractSysUser currentUser = getCurrentUser();
		String userId = currentUser.getId();
		String sqlXmls = " select t.code_unit from base_account_busi_unit t where 1 = 1 and t.dp_status = 1 and t.user_id = '"+userId+"' ";
		List<Map<String, String>> mapList = publicService.queryWhereSql(sqlXmls);
		if(null == mapList || 0 == mapList.size())
		{
			return ApiResponse.success(null);
		}
		
		if(mapList.size() > 0)
		{
			whereSql += " and ( ";
			Map<String, String> m = mapList.get(0);
			String code_unit = m.get("code_unit").toString();
			whereSql += " p.salesman_code like CONCAT('"+code_unit+"','%') ";
			
			for(int i=1;i<mapList.size();i++)
			{
				m = mapList.get(i);
				code_unit = m.get("code_unit").toString();
				whereSql += " or p.salesman_code like CONCAT('"+code_unit+"','%') ";
			}
			whereSql += " ) ";
		}
		
		fkAuditListExt.setWhereSql(whereSql);
        fkAuditListExt.notDeleted();
        PageVo page = getPage(fkAuditListExt);
        int records = fengKongShenHeService.selectByExtZppCount(fkAuditListExt);
        page.setRecords(records);
        if (records > 0) 
        {
        	List<FKAuditVo> list = new ArrayList<FKAuditVo>();
        	
        	fkAuditListExt.setOrderSql(" CREATED DESC ");
            redisObjectClient.execute(new RedisCallback<Boolean>() {
				@Override
				public Boolean doInRedis(RedisConnection redisConnection)
						throws DataAccessException {
					
					List<FkAuditList> fkAuditLists = fengKongShenHeService.selectByExtZpp(fkAuditListExt);
					for(int i=0;i<fkAuditLists.size();i++)
					{
						FkAuditList f = fkAuditLists.get(i);
						if(null == f)
						{
							continue;
						}
						String statusList_ = f.getStatusList() == null ? null : String.valueOf(f.getStatusList());
						SimpleDataDictionary statusListDic = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), statusList_, DataDicType.AUDITLISTSTATUS.getCode());
						String statusList = statusListDic == null ? "" : statusListDic.getName();
						String busiId = f.getBusiId();
						FKAuditVo auditVo = new FKAuditVo();
						auditVo.setModeId(f.getModeId());
						auditVo.setReplaceId(f.getId());
						auditVo.setBusiId(busiId);
						if(null == f.getCreated())
						{
							continue;
						}
						int s = f.getCreated();
						String busiConfirmTime = ZhppDateUtil.stampToDate(s,"yyyy-MM-dd HH:mm");
						auditVo.setBusiConfirmTime(busiConfirmTime);
						if(null == f.getLoanAmount() || ("").equals(f.getLoanAmount()))
						{
							f.setLoanAmount(0.0);
						}
						double loanAmount = f.getLoanAmount();
						BigDecimal bg = new BigDecimal(loanAmount);
						double amount = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
						auditVo.setLoanAmount(amount);   //单位换算成万 
						auditVo.setChannelStatusName(f.getChannelStatusName());
						auditVo.setChannelTypeName(f.getChannelTypeName());
						auditVo.setSource(f.getSource());
						auditVo.setDepartmentName(f.getDepartmentName());
						auditVo.setSalersmanName(f.getSalersmanName());
						auditVo.setCusName(f.getCusName());
						auditVo.setStatusList(statusList);
						auditVo.setDealer(f.getDealer());
						auditVo.setCustomerName(f.getCusName());
						auditVo.setCustomerNo(f.getCusIdno());
						auditVo.setOperatorId(f.getOperatorId());
						auditVo.setOperatorName(f.getOperatorName());
						
						//查询经销商登记
						YwBusiness business = iYwBusinessService.selectById(busiId);
						String dealerId = business.getDealerId();
						String sqlXmls = "select t.id,t.dealer_level from dp_base_dealer_info t where t.id = '"+dealerId+"' and t.dp_status = 1 limit 1";
						List<Map<String, String>> mpaMaps = publicService.queryWhereSql(sqlXmls);
						if(null != mpaMaps && mpaMaps.size() > 0)
						{
							String dealerLevel = mpaMaps.get(0).get("dealer_level") == null ? null : mpaMaps.get(0).get("dealer_level");
							SimpleDataDictionary dealerLevelDic = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), dealerLevel, DataDicType.DEALER_LEVEL.getCode());
							String dealerLevelDisplay = dealerLevelDic == null ? "" : dealerLevelDic.getName();
							auditVo.setDealerLevelDisplay(dealerLevelDisplay);
						}
						
						//如果是资审一审查询
						String modeId = paramsExt.getModeId();
						if(modeId.equals("M_zsys"))
						{
							sqlXmls = "select t.id,t.creator_name from fk_pre_audit_info t where t.busi_id = '"+f.getBusiId()+"' and t.mode_id = '"+modeId+"' and t.dp_status = 1 limit 1";
							List<Map<String, String>> resList = publicService.queryWhereSql(sqlXmls);
							if(null != resList && 0 != resList.size())
							{
								String customerName = resList.get(0).get("creator_name");
								auditVo.setUname(customerName);
							}
							else
							{
								auditVo.setUname("无");
							}
						}
						
						
						list.add(auditVo);
					}
					return true;
				}
			});
            
            page.setRows(list);
        } 
        else 
        {
            page.setRows(CollectionInitUtil.emptyList());
        }
        return ApiResponse.success(page);
    }
	
	
	/**
	* 财务审核
	* @author zhangpp
	* @Title: selectByExtCaiWu 
	* 
	* @param @param fkAuditListExt
	* @param @return    设定文件 
	* @return ApiResponse    返回类型 
	* @version V1.0
	* @throws
	 */
	@ApiOperation(value = "财务审核",response = FkAuditList.class, httpMethod="POST", tags={"财务审核"})
    @RequestMapping(value = "selectByExtCaiWu", method = RequestMethod.POST)
    public ApiResponse selectByExtCaiWu(@ModelAttribute FkAuditListExt fkAuditListExt,ParamsExt paramsExt) throws Exception
	{
		
		String whereSql = "";
		
		if(null != paramsExt && !("").equals(paramsExt))
		{
			String modeId = paramsExt.getModeId();
			
			if(null != modeId && !("").equals(modeId))
			{
				whereSql += "and mode_id = '"+modeId+"' and status_list = '"+fkAuditListExt.getStatusList()+"'";
			}
			
			String cusName = paramsExt.getCustomerName();
			
			if(null != cusName && !("").equals(cusName))
			{
				fkAuditListExt.setCusName(cusName);
			}
			
			String salersmanName = paramsExt.getSalesmanName();
			
			if(null != salersmanName && !("").equals(salersmanName))
			{
				fkAuditListExt.setSalersmanName(salersmanName);
			}
			
			int dayEnum = paramsExt.getDayEnum();
			int stamp = ZhppDateUtil.dateConvertStamp();
			
			if(dayEnum == 1)
			{
				whereSql += " and created >= "+stamp + " and created < "+(stamp + 86400);
			}
			else if(dayEnum == 2)
			{
				whereSql += " and created < "+stamp + " and created >= "+(stamp - 86400 * 2);  
			}
			else if(dayEnum == 3)
			{
				whereSql += " and created > (unix_timestamp() - 3600 * 24 * 7) ";
			}
			
			String submitTimeStart = paramsExt.getSubmitTimeStart();
			String submitTimeEnd = paramsExt.getSubmitTimeEnd();
			
			if((null != submitTimeStart && !("").equalsIgnoreCase(submitTimeStart)) && (null != submitTimeEnd && !("").equals(submitTimeEnd)))
			{
				int start = ZhppDateUtil.dateConvertTimeStamp(submitTimeStart, "yyyy-MM-dd");
				int end =  ZhppDateUtil.dateConvertTimeStamp(submitTimeEnd, "yyyy-MM-dd");
				whereSql += " and created >= "+start + " and created < "+ (end + 86400);
			}
			else
			{
				if(null != submitTimeStart && !("").equals(submitTimeStart))
				{
					int start = ZhppDateUtil.dateConvertTimeStamp(submitTimeStart, "yyyy-MM-dd");
					whereSql += " and created >= "+start;
				}
				else if(null != submitTimeEnd && !("").equals(submitTimeEnd))
				{
					int end =  ZhppDateUtil.dateConvertTimeStamp(submitTimeEnd, "yyyy-MM-dd");
					whereSql += " and created < "+ (end + 86400);
				}
			}
		}
		
		
		fkAuditListExt.setWhereSql(whereSql);
        fkAuditListExt.notDeleted();
        PageVo page = getPage(fkAuditListExt);
        int records = fengKongShenHeService.selectByExtCaiWuCount(fkAuditListExt);
        page.setRecords(records);
        if (records > 0) 
        {
        	
        	fkAuditListExt.setOrderSql(" CREATED DESC ");
        	 redisObjectClient.execute(new RedisCallback<Boolean>() {
 				@Override
 				public Boolean doInRedis(RedisConnection redisConnection)
 						throws DataAccessException {
 						List<FKAuditVo> list = new ArrayList<FKAuditVo>();
			            List<FkAuditList> fkAuditLists = fengKongShenHeService.selectByExtCaiWu(fkAuditListExt);
			            for(int i=0;i<fkAuditLists.size();i++)
			            {
			            	FkAuditList f = fkAuditLists.get(i);
			            	String statusList_ = f.getStatusList() == null ? null : String.valueOf(f.getStatusList());
							SimpleDataDictionary statusListDic = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), statusList_, DataDicType.AUDITLISTSTATUS.getCode());
							String statusList = statusListDic == null ? "" : statusListDic.getName();
			            	String busiId = f.getBusiId();
			            	FKAuditVo auditVo = new FKAuditVo();
			            	auditVo.setModeId(f.getModeId());
			            	auditVo.setReplaceId(f.getId());
			            	auditVo.setBusiId(busiId);
			            	int s = f.getCreated();
			            	String busiConfirmTime = ZhppDateUtil.stampToDate(s,"yyyy-MM-dd HH:mm");
			            	auditVo.setBusiConfirmTime(busiConfirmTime);
			            	if(null == f.getLoanAmount() || ("").equals(f.getLoanAmount()))
			            	{
			            		f.setLoanAmount(0.0);
			            	}
			            	double loanAmount = f.getLoanAmount();
			            	BigDecimal bg = new BigDecimal(loanAmount);
			            	double amount = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
			            	auditVo.setLoanAmount(amount);   //单位换算成万 
			            	auditVo.setChannelStatusName(f.getChannelStatusName());
			            	auditVo.setChannelTypeName(f.getChannelTypeName());
			            	auditVo.setSource(f.getSource());
			            	auditVo.setDepartmentName(f.getDepartmentName());
			            	auditVo.setSalersmanName(f.getSalersmanName());
			            	auditVo.setCusName(f.getCusName());
			            	auditVo.setStatusList(statusList);
			            	auditVo.setDealer(f.getDealer());
			            	auditVo.setCustomerName(f.getCusName());
			            	auditVo.setCustomerNo(f.getCusIdno());
			            	auditVo.setOperatorId(f.getOperatorId());
			            	auditVo.setOperatorName(f.getOperatorName());
			            	
			            	//查询经销商登记
			            	YwBusiness business = iYwBusinessService.selectById(busiId);
			            	if(null != business)
			            	{
			            		String dealerId = business.getDealerId();
			                	String sqlXmls = "select t.id,t.dealer_level from dp_base_dealer_info t where t.id = '"+dealerId+"' and t.dp_status = 1 limit 1";
			                	List<Map<String, String>> mpaMaps = publicService.queryWhereSql(sqlXmls);
			                	if(null != mpaMaps && mpaMaps.size() > 0)
			                	{
			                		String dealerLevel = mpaMaps.get(0).get("dealer_level") == null ? null : mpaMaps.get(0).get("dealer_level");
									SimpleDataDictionary dealerLevelDic = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), dealerLevel, DataDicType.DEALER_LEVEL.getCode());
									String dealerLevelDisplay = dealerLevelDic == null ? "" : dealerLevelDic.getName();
			                		auditVo.setDealerLevelDisplay(dealerLevelDisplay);
			                	}
			                	list.add(auditVo);
			            	}
			            }
			            page.setRows(list);
			            return true;
 				}
        	});
        } 
        else 
        {
            page.setRows(CollectionInitUtil.emptyList());
        }
        return ApiResponse.success(page);
    }
	
	
	/**
	* 风控审核  资料补齐审核 过审 
	* @author zhangpp
	* @Title: ziLiaoBuqiShenHeGuoShen 
	* 
	* @param @param paramsExt
	* @param @return
	* @param @throws Exception    设定文件 
	* @return ApiResponse    返回类型 
	* @version V1.0
	* @throws
	 */
	@RequestMapping(value="ziLiaoBuqiShenHeGuoShen",method = RequestMethod.POST, produces="application/json;charset=UTF-8")
	public ApiResponse ziLiaoBuqiShenHeGuoShen(@ApiIgnore OtherAuditInfo otherAuditInfo,ParamsExt paramsExt) throws Exception
	{
		AbstractSysUser currentUser = getCurrentUser();
		fengKongShenHeService.diepuZiLiaoBuqiShenHeGuoShen(currentUser,otherAuditInfo, paramsExt);
		return ApiResponse.success(true);
	}
	
	/**
	* 风控审核 资料补齐补审 历史审批通用
	* @author zhangpp
	* @Title: getOtherAuditInfoListVo 
	* 
	* @param @param paramsExt
	* @param @return
	* @param @throws Exception    设定文件 
	* @return ApiResponse    返回类型 
	* @version V1.0
	* @throws
	 */
	@RequestMapping(value="getOtherAuditInfoListVo",method = RequestMethod.POST, produces="application/json;charset=UTF-8")
	public Map<String, Object> getOtherAuditInfoListVo(@ApiIgnore ParamsExt paramsExt) throws Exception
	{
		Map<String, Object> maps = success();
		
		List<OtherAuditInfoListVo> result = fengKongShenHeService.getOtherAuditInfoListVo(paramsExt);
		maps.put("result", result);
		
		//风控审核 资料补齐补审 GPS数据查询
		if(null != paramsExt && !("").equals(paramsExt))
		{
			if(paramsExt.getMode_code().equals("M_zlbs"))
			{
				String busiId = paramsExt.getBusiId();
				if(null != busiId && !("").equals(busiId))
				{
					String whereSql = " and t.busi_id = '"+busiId+"'  limit 1";
					paramsExt.setWhereSql(whereSql);
					List<YwBusinessExtrasVo> gpsResult = fengKongShenHeService.getYwBusinessExtrasVo(paramsExt);
					maps.put("gpsResult", gpsResult);
				}
			}
		}
		return maps;
	}
	
	/**
	* 风控审核查询通用页面信息
	* @author zhangpp
	* @Title: getAuditListVo 
	* 
	* @param @param paramsExt
	* @param @return
	* @param @throws Exception    设定文件 
	* @return ApiResponse    返回类型 
	* @version V1.0
	* @throws
	 */
	@RequestMapping(value="getAuditListVo",method = RequestMethod.POST, produces="application/json;charset=UTF-8")
	public ApiResponse getAuditListVo(@ApiIgnore ParamsExt paramsExt) throws Exception
	{
		String whereSql = "";
		String orderSql = "";
		
		if(null != paramsExt && !("").equals(paramsExt))
		{
			String cus_name = paramsExt.getCus_name();
			String salersman_name = paramsExt.getSalersman_name();
			
			//条件
			if(null != cus_name && !("").equals(cus_name))
			{
				whereSql += " and t.cus_name like CONCAT('%', '"+cus_name+"', '%')";
			}
			
			if(null != salersman_name && !("").equals(salersman_name))
			{
				whereSql += " and t.salersman_name like CONCAT('%', '"+salersman_name+"', '%')";
			}
			
			//排序
			String sidx = paramsExt.getSidx();
			String sord = paramsExt.getSord();
			
			if(null != sidx && !("").equals(sidx))
			{
				orderSql += " order by t."+sidx+" "+sord+" ";
			}
			
			//模块标识
			String mode_code = paramsExt.getMode_code();
			//模块标识
			
			whereSql += " and t.mode_id = '"+mode_code+"' ";
			
			//条件
			paramsExt.setWhereSql(whereSql);
			//条件
			
			//排序
			paramsExt.setOrderSql(orderSql);
			//排序
		}
		
		paramsExt.notDeleted();
		PageVo page = getPage(paramsExt);
        int records = fengKongShenHeService.getAuditListVoCount(paramsExt);
        page.setRecords(records);
        if (records > 0) 
        {
            List<FkAuditListVo> dhywDyVos = fengKongShenHeService.getAuditListVo(paramsExt);
            page.setRows(dhywDyVos);
        } 
        else 
        {
            page.setRows(CollectionInitUtil.emptyList());
        }
        return ApiResponse.success(page);
	}
	
	
	
	
	/**
	* 风控审核查询，加数据范围
	* @author zhangpp
	* @Title: getFengKongShenHelist 
	* 
	* @param @param fkAuditListExt
	* @param @return    设定文件 
	* @return ApiResponse    返回类型 
	* @version V1.0
	* @throws
	 */
	@ApiOperation(value = "风控审核查询，加数据范围",response = FkAuditList.class, httpMethod="POST", tags={"风控审核查询，加数据范围"})
    @RequestMapping(value = "diepuFengKongShenHeV001List", method = RequestMethod.POST)
    public ApiResponse diepuFengKongShenHeV001List(@ModelAttribute FkAuditListExt fkAuditListExt,ParamsExt paramsExt) throws Exception
	{
		String whereSql = "";
		String modeId = paramsExt.getModeId();
		
		if(null != paramsExt && !("").equals(paramsExt))
		{
			
			if(null != modeId && !("").equals(modeId))
			{
				whereSql += "and t.mode_id = '"+modeId+"' and t.status_list = '"+fkAuditListExt.getStatusList()+"'";
			}
			
			String cusName = paramsExt.getCustomerName();
			
			if(null != cusName && !("").equals(cusName))
			{
				fkAuditListExt.setCusName(cusName);
			}
			
			String salersmanName = paramsExt.getSalesmanName();
			
			if(null != salersmanName && !("").equals(salersmanName))
			{
				fkAuditListExt.setSalersmanName(salersmanName);
			}
			
			int dayEnum = paramsExt.getDayEnum();
			int stamp = ZhppDateUtil.dateConvertStamp();
			
			if(dayEnum == 1)
			{
				whereSql += " and t.created >= "+stamp + " and t.created < "+(stamp + 86400);
			}
			else if(dayEnum == 2)
			{
				whereSql += " and t.created < "+stamp + " and t.created >= "+(stamp - 86400 * 2);  
			}
			else if(dayEnum == 3)
			{
				whereSql += " and t.created > (unix_timestamp() - 3600 * 24 * 7) ";
			}
			
			String submitTimeStart = paramsExt.getSubmitTimeStart();
			String submitTimeEnd = paramsExt.getSubmitTimeEnd();
			
			if((null != submitTimeStart && !("").equalsIgnoreCase(submitTimeStart)) && (null != submitTimeEnd && !("").equals(submitTimeEnd)))
			{
				int start = ZhppDateUtil.dateConvertTimeStamp(submitTimeStart, "yyyy-MM-dd");
				int end =  ZhppDateUtil.dateConvertTimeStamp(submitTimeEnd, "yyyy-MM-dd");
				whereSql += " and t.created >= "+start + " and t.created < "+ (end + 86400);
			}
			else
			{
				if(null != submitTimeStart && !("").equals(submitTimeStart))
				{
					int start = ZhppDateUtil.dateConvertTimeStamp(submitTimeStart, "yyyy-MM-dd");
					whereSql += " and t.created >= "+start;
				}
				else if(null != submitTimeEnd && !("").equals(submitTimeEnd))
				{
					int end =  ZhppDateUtil.dateConvertTimeStamp(submitTimeEnd, "yyyy-MM-dd");
					whereSql += " and t.created < "+ (end + 86400);
				}
			}
		}
		
		if(!modeId.equals("M_tyjxbsh"))
		{
			//登录用户银行范围查询
			SysUser sysUser =(SysUser)getCurrentUser();
			String lBank = sysUser.getLoanBank();
			whereSql += systemService.getBankSqlXmls(lBank, "p.bank_loan");
			//登录用户银行范围查询
		}
		
		//按数据范围查询
		AbstractSysUser currentUser = getCurrentUser();
		String userId = currentUser.getId();
		String sqlXmls = " select t.code_unit from base_account_busi_unit t where 1 = 1 and t.dp_status = 1 and t.user_id = '"+userId+"' ";
		List<Map<String, String>> mapList = publicService.queryWhereSql(sqlXmls);
		if(null == mapList || 0 == mapList.size())
		{
			return ApiResponse.success(null);
		}
		
		if(mapList.size() > 0)
		{
			whereSql += " and ( ";
			Map<String, String> m = mapList.get(0);
			String code_unit = m.get("code_unit").toString();
			whereSql += " p.salesman_code like CONCAT('"+code_unit+"','%') ";
			
			for(int i=1;i<mapList.size();i++)
			{
				m = mapList.get(i);
				code_unit = m.get("code_unit").toString();
				whereSql += " or p.salesman_code like CONCAT('"+code_unit+"','%') ";
			}
			whereSql += " ) ";
		}
		
		fkAuditListExt.setWhereSql(whereSql);
        fkAuditListExt.notDeleted();
        PageVo page = getPage(fkAuditListExt);
        int records = fengKongShenHeService.selectByExtZppCount(fkAuditListExt);
        page.setRecords(records);
        if (records > 0) 
        {
        	List<FKAuditVo> list = new ArrayList<FKAuditVo>();
        	if(StringUtils.isBlank(paramsExt.getOrderSql()))
        	{
        		paramsExt.setOrderSql("t.busi_confirm_time desc");
        	}
        	fkAuditListExt.setOrderSql(paramsExt.getOrderSql());
        	List<FkAuditList> fkAuditLists = fengKongShenHeService.selectByExtZpp(fkAuditListExt);
			for(int i=0;i<fkAuditLists.size();i++)
			{
				FkAuditList f = fkAuditLists.get(i);
				if(null == f)
				{
					continue;
				}
				String statusList_ = f.getStatusList() == null ? null : String.valueOf(f.getStatusList());
				String statusList = publicService.getDictionaryName(statusList_, DataDicType.AUDITLISTSTATUS.getCode());
				String busiId = f.getBusiId();
				FKAuditVo auditVo = new FKAuditVo();
				auditVo.setModeId(f.getModeId());
				auditVo.setReplaceId(f.getId());
				auditVo.setBusiId(busiId);
				if(null == f.getCreated())
				{
					continue;
				}
				int s = f.getCreated();
				String busiConfirmTime = ZhppDateUtil.stampToDate(s,"yyyy-MM-dd HH:mm");
				auditVo.setBusiConfirmTime(busiConfirmTime);
				if(null == f.getLoanAmount() || ("").equals(f.getLoanAmount()))
				{
					f.setLoanAmount(0.0);
				}
				double loanAmount = f.getLoanAmount();
				BigDecimal bg = new BigDecimal(loanAmount);
				double amount = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
				auditVo.setLoanAmount(amount);   //单位换算成万 
				auditVo.setChannelStatusName(f.getChannelStatusName());
				auditVo.setChannelTypeName(f.getChannelTypeName());
				auditVo.setSource(f.getSource());
				auditVo.setDepartmentName(f.getDepartmentName());
				auditVo.setSalersmanName(f.getSalersmanName());
				auditVo.setCusName(f.getCusName());
				auditVo.setStatusList(statusList);
				auditVo.setDealer(f.getDealer());
				auditVo.setCustomerName(f.getCusName());
				auditVo.setCustomerNo(f.getCusIdno());
				auditVo.setOperatorId(f.getOperatorId());
				auditVo.setOperatorName(f.getOperatorName());
				auditVo.setBankname(f.getBankname());
				
				//查询经销商登记
				YwBusiness business = iYwBusinessService.selectById(busiId);
				String dealerId = business.getDealerId();
				sqlXmls = "select t.id,t.dealer_level from dp_base_dealer_info t where t.id = '"+dealerId+"' and t.dp_status = 1 limit 1";
				List<Map<String, String>> mpaMaps = publicService.queryWhereSql(sqlXmls);
				if(null != mpaMaps && mpaMaps.size() > 0)
				{
					String dealerLevel = mpaMaps.get(0).get("dealer_level") == null ? null : mpaMaps.get(0).get("dealer_level");
					String dealerLevelDisplay = publicService.getDictionaryName(dealerLevel,  DataDicType.DEALER_LEVEL.getCode());
					auditVo.setDealerLevelDisplay(dealerLevelDisplay);
				}
				
				//如果是资审一审查询
				if(modeId.equals(ModeIDType.ZSYS.getCode()))
				{
					sqlXmls = "select t.id,t.creator_name from fk_pre_audit_info t where t.busi_id = '"+f.getBusiId()+"' and t.mode_id = '"+modeId+"' and t.dp_status = 1 limit 1";
					List<Map<String, String>> resList = publicService.queryWhereSql(sqlXmls);
					if(null != resList && 0 != resList.size())
					{
						String customerName = resList.get(0).get("creator_name");
						auditVo.setUname(customerName);
					}
					else
					{
						auditVo.setUname("无");
					}
				}
				
				//鑫合汇资审一审审核
				if(modeId.equals(ModeIDType.XHHZSYS.getCode()))
				{
					sqlXmls = "select count(t.id) count from other_attachments t where t.dataid = '"+busiId+"' and (t.attachment_sort = '19' or t.attachment_sort = '33') and t.dp_status = 1";
					int count = publicService.countSqlXmls(sqlXmls);
					if(count > 0)
					{
						auditVo.setFileStatus("附件已上传");
					}
					else
					{
						auditVo.setFileStatus("附件未上传");
					}
				}
				list.add(auditVo);
			}
            page.setRows(list);
        } 
        else 
        {
            page.setRows(CollectionInitUtil.emptyList());
        }
        return ApiResponse.success(page);
    }
	
	
	/**
	*  风控审核操作
	*  @author  zhangpp
	*  @Title:  diepuFengKongShenHeV001  
	*    
	*  @param  @param request
	*  @param  @param fkAuditList
	*  @param  @param otherAuditInfo
	*  @param  @return
	*  @param  @throws Exception        设定文件  
	*  @return  Map<String,Object>        返回类型  
	*  @version  V1.0
	*  @throws
	 */
	@ApiOperation(value = "风控审核操作",response = FkAuditList.class, httpMethod="POST", tags={"风控审核操作"})
    @RequestMapping(value = "diepuFengKongShenHeV001", method = RequestMethod.POST)
	public Map<String, Object> diepuFengKongShenHeV001(HttpServletRequest request,FkAuditList fkAuditList,OtherAuditInfo otherAuditInfo,String event,FengKongShenHeV001ZiDongExe fengKongShenHeV001ZiDongExe)throws Exception
	{
		Map<String, Object> maps = success();
		HttpSession session = request.getSession();      
		ServletContext  application  = session.getServletContext();  
		AbstractSysUser currentUser = getCurrentUser();
		String serverRealPath = application.getRealPath("/WEB-INF/configure/fkshConfV001.json");
		
		String modeId = fkAuditList.getModeId();
		
		//如果执行的是退回	
		if(event.equals("auditback"))
		{
			String[] TM = fkAuditList.getModeId().split("@@@");
			modeId = TM[0];
		}
		
		//财务审核一  不需要锁单
		if(modeId.equals("M_cwshy"))
		{
			fengKongShenHeService.diepuFengKongShenHeV001(currentUser, fkAuditList, otherAuditInfo, event,serverRealPath,fengKongShenHeV001ZiDongExe);
			return maps;
		}
		
		//查询锁定人
		FkAuditList auditList = new FkAuditList();
		auditList.setModeId(modeId);
		auditList.setBusiId(fkAuditList.getBusiId());
		auditList.setStatusList(1);
		auditList.setDpStatus(1);
		auditList = iFkAuditListService.selectRefined(auditList);
		if(null == auditList)
		{
			throw new BaseException(ResultFlagType.MISSING.getCode().toString(),"待审批数据为空，未找到");
		}
		
		String userId = currentUser.getId();
		if(StringUtils.isBlank(userId))
		{
			throw new BaseException(ResultFlagType.LOGIN_TIMEOUT.getCode().toString(),ResultFlagType.LOGIN_TIMEOUT.getValue());
		}
		
		if(StringUtils.isBlank(auditList.getOperatorId()))
		{
			throw new BaseException(ResultFlagType.MISSING.getCode().toString(),"此审核没有被锁单，请联系管理员");
		}
		
		if(userId.trim().equals(auditList.getOperatorId().trim()))
		{
			fengKongShenHeService.diepuFengKongShenHeV001(currentUser, fkAuditList, otherAuditInfo, event,serverRealPath,fengKongShenHeV001ZiDongExe);
		}
		else
		{
			throw new BaseException(ResultFlagType.MISSING.getCode().toString(),"此审核已经被锁定，无法操作");
		}
		return maps;
	}
	
	
	/**
	*  风控审核 页面显示数据
	*  @author  zhangpp
	*  @Title:  diepuFengKongShenHeAuditListV001  
	*    
	*  @param  @param paramsExt
	*  @param  @return
	*  @param  @throws Exception        设定文件  
	*  @return  Map<String,Object>        返回类型  
	*  @version  V1.0
	*  @throws
	 */
	@RequestMapping(value="diepuFengKongShenHeAuditListV001",method = RequestMethod.POST, produces="application/json;charset=UTF-8")
	public Map<String, Object> diepuFengKongShenHeAuditListV001(HttpServletRequest request,String busiId,String modeId) throws Exception
	{
		Map<String, Object> maps = success();
		HttpSession session = request.getSession();      
		ServletContext  application  = session.getServletContext();  
		String serverRealPath = application.getRealPath("/WEB-INF/configure/fkshConfV001.json");
		
		JsonParser parse =new JsonParser();  
		JsonObject json = (JsonObject) parse.parse(new FileReader(serverRealPath)); 
		JsonArray  array = json.get("result").getAsJsonArray();
		if(null == array || 0 == array.size())
		{
			throw new BaseException(ResultFlagType.FAIL.getCode().toString(),"读取审核配置文件为空");
		}
		
		//风控审核>鑫合汇资审一审审核
		if(modeId.equals(ModeIDType.XHHZSYS.getCode()))
		{
			String sqlXmls = "select t.id,t.file_label from other_attachments t where t.dataid = '"+busiId+"' and t.file_label <> 'label65' and t.dp_status = 1 and (t.attachment_sort = '33' or t.attachment_sort = '19') group by t.file_label";
			List<Map<String, String>> xhhFile = publicService.queryWhereSql(sqlXmls);
			maps.put("xhhFile", xhhFile);
		}
		
		boolean modeIdBoolean = false;
		
		for(int i=0;i<array.size();i++)
		{
			JsonObject object = array.get(i).getAsJsonObject();
			String resultModeId = object.get("modeId").getAsString();
			
			if(modeId.equals(resultModeId))
			{
				modeIdBoolean = true;
				
				//所有的模块必须查询
				FkAuditList fkAuditList = new FkAuditList();
				fkAuditList.setModeId(modeId);
				fkAuditList.setBusiId(busiId);
				fkAuditList.setDpStatus(1);
				fkAuditList.setStatusList(1);
				fkAuditList = iFkAuditListService.selectRefined(fkAuditList);
				maps.put("fkAuditList", fkAuditList);
				
				//公用必须查询
				ParamsExt paramsExt = new ParamsExt();
				String whereSql = " and t.busi_id = '"+ busiId +"'";
				paramsExt.setWhereSql(whereSql);
				List<OtherAuditInfoListVo> otherAuditInfo = fengKongShenHeService.getOtherAuditInfoListVo(paramsExt);
				maps.put("otherAuditInfo", otherAuditInfo);
				
				//显示事件
				JsonArray  arrayDisplayEvent = object.get("displayEvent").getAsJsonArray();
				if(null != arrayDisplayEvent && arrayDisplayEvent.size() > 0)
				{
					for(int x=0;x<arrayDisplayEvent.size();x++)
					{
						JsonObject objectDisplayEvent = arrayDisplayEvent.get(x).getAsJsonObject();
						String displayPass = objectDisplayEvent.get("displayPass").getAsString();
						
						if(displayPass.equals("DISPLAY001"))
						{
							String gpsDisplay = objectDisplayEvent.get("gpsDisplay").getAsString();
							if(gpsDisplay.equals("yes"))
							{
								whereSql = " and t.busi_id = '"+busiId+"'";
								paramsExt.setWhereSql(whereSql);
								List<YwBusinessExtrasVo> gpsResult = fengKongShenHeService.getYwBusinessExtrasVo(paramsExt);
								maps.put("gpsResult", gpsResult);
							}
						}
						else if(displayPass.equals("DISPLAY002"))
						{
							String gpsPreservation = objectDisplayEvent.get("gpsPreservation").getAsString();
							maps.put("gpsPreservation", gpsPreservation);
						}
						else if(displayPass.equals("DISPLAY003"))
						{
							String gpsDisable = objectDisplayEvent.get("gpsDisable").getAsString();
							maps.put("gpsDisable", gpsDisable);
						}
						else if(displayPass.equals("DISPLAY004"))
						{
							String getZlbqsh = objectDisplayEvent.get("getZlbqsh").getAsString();
							if(getZlbqsh.equals("yes"))
							{
								YwBusiness ywBusiness = iYwBusinessService.selectById(busiId);
								maps.put("ywBusiness", ywBusiness);
							}
						}
						else if(displayPass.equals("DISPLAY005"))
						{
							String getZlbqsh = objectDisplayEvent.get("getZlbqsh").getAsString();
							if(getZlbqsh.equals("yes"))
							{
								FkPreAuditInfo fkPreAuditInfo = new FkPreAuditInfo();
								fkPreAuditInfo.setBusiId(busiId);
								fkPreAuditInfo.setDpStatus(1);
								fkPreAuditInfo = iFkPreAuditInfoService.selectRefined(fkPreAuditInfo);
								maps.put("fkPreAuditInfo", fkPreAuditInfo);
							}
						}
						else if(displayPass.equals("DISPLAY006"))
						{
							String diankuanTZ = objectDisplayEvent.get("diankuanTZ").getAsString();
							maps.put("diankuanTZ", diankuanTZ);
						}
						else if(displayPass.equals("DISPLAY007"))
						{
							String gpsDisable = objectDisplayEvent.get("gpsDisable").getAsString();
							maps.put("DISPLAY007", gpsDisable);
						}
						else if(displayPass.equals("DISPLAY008"))
						{
							String gpsDisable = objectDisplayEvent.get("gpsDisable").getAsString();
							maps.put("DISPLAY008", gpsDisable);
						}
						
						//按钮权限
						JsonArray  arrayEvent = object.get("event").getAsJsonArray();
						if(null != arrayEvent && arrayEvent.size() > 0)
						{
							List<EventPass> eventPasses = new ArrayList<EventPass>();
							for(int j=0;j<arrayEvent.size();j++)
							{
								JsonObject objectEvent = arrayEvent.get(j).getAsJsonObject();
								String event = objectEvent.get("event").getAsString();
								EventPass eventPass = new EventPass();
								eventPass.setEvent(event);
								eventPasses.add(eventPass);
							}
							maps.put("eventPasses", eventPasses);
						}
					}
				}
				break;
			}
		}
		
		if(!modeIdBoolean)
		{
			throw new BaseException(ResultFlagType.FAIL.getCode().toString(),"此节点在配置文件没有找到，请检查");
		}
		return maps;
	}
	
	/**
	*  财务审核初始化查询
	*  @author  zhangpp
	*  @Title:  diepuCwshyInit  
	*    
	*  @param  @param busiId
	*  @param  @param modeId
	*  @param  @return
	*  @param  @throws Exception        设定文件  
	*  @return  Map<String,Object>        返回类型  
	*  @version  V1.0
	*  @throws
	 */
	@RequestMapping(value="diepuCwshyInit",method = RequestMethod.POST, produces="application/json;charset=UTF-8")
	public Map<String, Object> diepuCwshyInit(String busiId,String modeId) throws Exception
	{
		Map<String, Object> maps = success();
		YwBusiness ywBusiness = iYwBusinessService.selectById(busiId);
		ywBusiness.setThirdBusiStatusDisplay((String)CachedEnums.getValue(ywBusiness.getThirdBusiStatus(), ThirdBusiStatus.class));
		maps.put("ywBusiness", ywBusiness);
		
		String sqlXmls = "select t.id,t.time_arrive from cw_refund_car t where t.busi_id = '"+busiId+"' order by t.time_arrive desc limit 1";
		Map<String, Date> list = publicService.selectDateSql(sqlXmls);
		Date time_arrive = null;
		if(null != list && list.size() > 0)
		{
			time_arrive = list.get("time_arrive");
		}
		maps.put("timeArrive", time_arrive);
		return maps;
	}
	
	/**
	*  风控审核列表增加锁单判断
	*  @author  zhangpp
	*  @Title:  getLoanEditLock  
	*    
	*  @param  @param busiId
	*  @param  @param modeId
	*  @param  @return
	*  @param  @throws Exception        设定文件  
	*  @return  Map<String,Object>        返回类型  
	*  @version  V1.0
	*  @throws
	 */
	@RequestMapping(value="getLoanEditLock",method = RequestMethod.POST, produces="application/json;charset=UTF-8")
	public Map<String, Object> getLoanEditLock(String busiId,String modeId) throws Exception
	{
		Map<String, Object> maps = success();
		
		HttpSession session = request.getSession();      
    	ServletContext  application  = session.getServletContext();  
		String serverRealPath = application.getRealPath("/WEB-INF/configure/fkshConfV001.json");
    	
		JsonParser parse = new JsonParser();  
		JsonObject json = (JsonObject) parse.parse(new FileReader(serverRealPath)); 
		JsonArray  array = json.get("result").getAsJsonArray();
		if(null == array || 0 == array.size())
		{
			throw new BaseException(ResultFlagType.FAIL.getCode().toString(),"读取审核配置文件为空");
		}
		
		for(int i=0;i<array.size();i++)
		{
			JsonObject object = array.get(i).getAsJsonObject();
			String resultModeId = object.get("modeId").getAsString();
			
			//寻找走向的模板
			if(modeId.equals(resultModeId))
			{
				JsonArray  objectArray = object.get("additionalEvent").getAsJsonArray();
				if(null != objectArray && objectArray.size() > 0)
				{
					for(int j=0;j<objectArray.size();j++)
					{
						JsonObject objectDisplayEvent = objectArray.get(j).getAsJsonObject();
						String displayPass = objectDisplayEvent.get("addEvent").getAsString();
						
						if(displayPass.equals("LoanEditLock"))
						{ 
							String gpsDisable = objectDisplayEvent.get("switch").getAsString();
							if(gpsDisable.equals("open"))
							{
								String sqlXmls = "select count(t.id) count from yw_business_extras t  where t.code_extras = 'LoanEditLock' and t.value_extras = '1' and t.dp_status = 1 and t.busi_id = '"+busiId+"'";
								int count = publicService.countSqlXmls(sqlXmls);
								if(count > 0)
								{
									throw new BaseException(ResultFlagType.FAIL.getCode().toString(), "该订单正在申请修改贷款信息，不允许审核");
								}
								break;
							}
						}
					}
				}
				break;
			}
		}
		return maps;
	}
	
	/**
	 * 维度统计
	 * @param modeId
	 * @param modeIdType
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value="getStatistics",method = RequestMethod.POST, produces="application/json;charset=UTF-8")
	public Map<String, Object> getStatistics(String modeId,String modeIdType) throws Exception
	{
		Map<String, Object> maps = success();
		if(modeIdType.equals("fksh"))
		{
			String sqlXmls = "select t.id,t.cus_name,t.loan_amount from fk_audit_list t where t.mode_id = '"+modeId+"' and t.status_list = 1 and t.dp_status = 1 order by t.loan_amount desc";
			List<Map<String, String>> resultFksh = publicService.queryWhereSql(sqlXmls);
			maps.put("resultFksh", resultFksh);
			
			sqlXmls = "select t.id,count(t.channel_type)channel_type,t.channel_type_name from fk_audit_list t where t.mode_id = '"+modeId+"' and t.status_list = 1 and t.dp_status = 1 group by t.channel_type";
			List<Map<String, String>> resultChannelName = publicService.queryWhereSql(sqlXmls);
			maps.put("resultChannelName",resultChannelName);
		}
		else if(modeIdType.equals("zengJiaPeiOuDanBaoRen"))
		{
			String sqlXmls = "";
			sqlXmls += "select";
			sqlXmls += "	t.id, ";
			sqlXmls += "	t.cus_name, ";
			sqlXmls += "	( ";
			sqlXmls += "		select count(sub1.id) from zx_query_credit_apply_sub sub1 ";
			sqlXmls += "		where sub1.dp_status = 1 and sub1.query_credit_apply_id = t.query_credit_apply_id ";
			sqlXmls += "	)credit_people_type_count ";
			sqlXmls += "from zx_query_credit_apply_sub t where t.dp_status = 1 and t.credit_people_type = '03' ";
			sqlXmls += "and t.created > (unix_timestamp() - 3600 * 24 * 10) ";
			sqlXmls += "order by credit_people_type_count desc ";
			List<Map<String, String>> resultCreditPeopleTypeCount = publicService.queryWhereSql(sqlXmls);
			maps.put("resultCreditPeopleTypeCount", resultCreditPeopleTypeCount);
		}
		else if(modeIdType.equals("xiTongFenBianLv"))
		{
			String sqlXmls = "select t.id,t.clientWidth,count(t.id)wndthCount from base_distinguish t where t.dp_status = 1 group by t.clientWidth";
			List<Map<String, String>> resultClientWidth = publicService.queryWhereSql(sqlXmls);
			maps.put("resultClientWidth", resultClientWidth);
		}
		return maps;
	}
}
